#pragma once

#include <GL/glut.h>
#include <GL/glext.h>
#include "loadTGA.h"
#include "vector3D.h"
#include <time.h>

#define CUBE_SIZE 5

// For Particles
typedef struct
{
	float r,g,b;
	float life;
	/*float posX, posY;
	float velX, velY;*/
	Vector3D pos,vel;
	float angle;
}Particle;

/**
	* Class for Particle
	*
	* Render particles
	* Update particles
*/
class ParticleSystem{
private:
	int MaxParticle;
	Particle *ps;
	//TextureImage particles[1];
	GLuint particleDL;
	float startPosY, endPosX, endPosZ;
	bool Particle3D;
public:
	ParticleSystem(void);
	~ParticleSystem(void);

	/**
		* Function to initialize particles
		*
		* @param The max number of particles to render
		* @param The starting position along Y axis to render
		* @param The ending position along X axis to render
		* @param The ending position along Z axis to render
		* @param True for 3D particles, false for 2D particles
	*/
	void InitParticle(int MaxNumberOfParticles, float startPosY, float endPosX, float endPosZ, bool Particle3D);
	
	/**
		* Function to render the particles
	*/
	void RenderParticle(void);
	
	/**
		* Function to update the particles
		* 
		* @param Elapsed time for frame independant movement
		* @param How much to decrease the life of the particle each frame
		* @param How fast to move the particle
	*/
	void UpdateParticle(float elapsedTime, float lifeDecrease, float particleSpeed);
};